package edu.hubu.work01.controller;

import edu.hubu.work01.entity.User;
import edu.hubu.work01.Service.UserService;
import edu.hubu.work01.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/user/check")
    public ResultVO check(String account){
        return userService.checkAccount(account);
    }
    @RequestMapping("/user/regist")
    public ResultVO regist(User user){
         return userService.saveUser(user);

    }
    @RequestMapping("/user/login")
    public ResultVO login(String account, String pwd){
        return userService.cherkAccountPwd(account,pwd);
    }
}